package com;

import com.baidu.translate.baidu.universaltranslation.TransApi;

import java.io.UnsupportedEncodingException;

public class universaltranslationTest {

    // 在平台申请的APP_ID 详见 http://api.fanyi.baidu.com/api/trans/product/desktop?req=developer
    /**
     * 开发者ID
     */
    private static final String APP_ID = "20181025000225318";
    /**
     * 开发者密钥
     */
    private static final String SECURITY_KEY = "s0rbKVj44RcEH9m4yXrf";

    public static void main(String[] args) throws Exception {
        TransApi api = new TransApi(APP_ID, SECURITY_KEY);

        String query = "阿拉斯加";
        try {
            String transResult = api.getTransResult(query, "auto", "en");
            System.out.println(transResult);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }

}
